//
//  DCTaskDetailFooterView.m
//  JiuyaoMotorcade
//
//  Created by 大橙子 on 2018/11/29.
//  Copyright © 2018 Tomous. All rights reserved.
//

#import "DCTaskDetailFooterView.h"
@interface DCTaskDetailFooterView ()
@property (nonatomic,strong) DCImageAndTextLabel *suvLabel;
@property (nonatomic,strong) DCImageAndTextLabel *carLabel;
@property (nonatomic,strong) UILabel *totalLabel;
@end
@implementation DCTaskDetailFooterView
-(instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        self.backgroundColor = [UIColor whiteColor];
        
        DCImageAndTextLabel *suvLabel = [[DCImageAndTextLabel alloc]init];
        suvLabel.imageView.image = IMAGENAME(@"SUV");
        suvLabel.textLabel.textColor = [UIColor blackColor];
        self.suvLabel = suvLabel;
        [self addSubview:suvLabel];
        
        DCImageAndTextLabel *carLabel = [[DCImageAndTextLabel alloc]init];
        carLabel.imageView.image = IMAGENAME(@"car");
        carLabel.textLabel.textColor = [UIColor blackColor];
        self.carLabel = carLabel;
        [self addSubview:carLabel];
        
        UILabel *totalLabel = [[UILabel alloc]init];
        self.totalLabel = totalLabel;
        [self addSubview:totalLabel];
    }
    return self;
}
-(void)layoutSubviews {
    [super layoutSubviews];
    self.suvLabel.frame = CGRectMake(10, 0, self.width/3, 40);
    self.carLabel.frame = CGRectMake(self.suvLabel.right, 0, self.suvLabel.width, self.suvLabel.height);
    self.totalLabel.frame = CGRectMake(self.carLabel.right, 0, self.suvLabel.width, self.suvLabel.height);
}
-(void)setModel:(DCTaskDetailOddArray *)model {
    _model = model;
    self.suvLabel.textLabel.attributedText = [YLAttributedStr changNumberColorWithTotalString:[NSString stringWithFormat:@"%@台",model.suvNumber] andColor:[UIColor redColor]];
    self.carLabel.textLabel.attributedText = [YLAttributedStr changNumberColorWithTotalString:[NSString stringWithFormat:@"%@台",model.carNumber] andColor:[UIColor redColor]];
    self.totalLabel.attributedText = [YLAttributedStr changNumberColorWithTotalString:[NSString stringWithFormat:@"共计   %@台",model.totalNumber] andColor:[UIColor redColor]];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
